define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    return {
        index: function () {
            Table.api.init({
                extend: {
                    index_url: 'zzcash/in/index' + location.search,
                    table    : 'zzcash_in',
                }
            })
            var table = $("#table")
            table.bootstrapTable({
                url     : $.fn.bootstrapTable.defaults.extend.index_url,
                pk      : 'id',
                sortName: 'id',
                columns : [
                    [
                        {checkbox: true},
                        {field: 'id', title: 'id'},
                        {field: 'user.nickname', title: '用户', formatter: Table.api.formatter.search},
                        {field: 'money', title: '充值金额', operate: 'BETWEEN'},
                        {field: 'payed_is', title: '是否已支付', searchList: Config.payed_is_map, formatter: Table.api.formatter.label},
                        {field: 'create_at', title: '创建时间', operate: 'range', addclass: 'datetimerange', formatter: Table.api.formatter.datetimerange},
                    ]
                ]
            });
            Table.api.bindevent(table)
        },
        add  : function () {
            Form.api.bindevent($("form[role=form]"))
        },
        edit : function () {
            Form.api.bindevent($("form[role=form]"))
        }
    }
})
